﻿#ifndef UDeviceConfig_H
#define UDeviceConfig_H



#include <QWidget>
#include "ui_UDeviceConfig.h"
#include "CDevBase.h"
class UDeviceConfig : public QWidget
{
	Q_OBJECT

public:
	UDeviceConfig(CDevBase *pDev,QWidget *parent = nullptr);
	~UDeviceConfig();
	void initUi();
private:
	void initUi(CDevDataBase* pDevData);
	void getDbData();   //获取数据库plc配置信息
	void getPlcData();   //获取plc配置信息
	bool savePlc(QString& sInfo);//保存Plc
	bool writePlc(int dValue, EWAddrNameRob enWAddr);
	QMap<QString, double> getChangedValue(QString& sInfo);//将发生改变了的保存在Map中返回
private:
	Ui::UDeviceConfigClass ui;
	CDevBase* m_pDev;
	CDevDataBase *m_pDevData;
	CDevDataBase* m_pDevDataDb;
public slots:
	void slot_saveToPlc();
	void slot_readFromPlc();
	void slot_saveToDb();
	void slot_readFromDb();
	void slot_cancel();
};
#endif